From 771dbe059248a6f263ec72aa41f1f54f21d94208 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 23 Aug 2013 23:08:13 -0700 Subject: [PATCH] wayland: Compare serial numbers correctly to avoid overflow problems We have to look at the difference between two numbers, which will always be well-defined and give the right result, even in case of integer overflow. --- gdk/wayland/gdkdisplay-wayland.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index db47bfe0cc..e9424b208c 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -678,8 +678,12 @@ void _gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display, guint32 serial) { - if (serial > wayland_display->serial) + if (serial - wayland_display->serial < 1000) wayland_display->serial = serial; + else + g_warning (G_STRLOC ": serial number jump bigger than 1000 (%u -> %u", + wayland_display->serial, serial); + } /** -- 2.30.2